<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google AJAX Language API Sample</title>
    <script src="https://www.google.com/jsapi?key=ABQIAAAA4IcwRRCOi6Fv2b3nIbxOChQGaOCnSmUhRGiZvi2Xd9QiyjfnaxSIrWmoOaja1VYTgGmq1letHra6Pw"></script>
    <script type="text/javascript">

    google.load("language", "1");

    function initialize() {
      var content = document.getElementById('content');
      // Setting the text in the div.
      content.innerHTML = '<div id="text">Привет, мир.<\/div><div id="translation"/>';

      // Grabbing the text to translate
      var text = document.getElementById("text").innerHTML;

      // Translate from Spanish to English, and have the callback of the request
      // put the resulting translation in the "translation" div.
      // Note: by putting in an empty string for the source language ('es') then the translation
      // will auto-detect the source language.
      google.language.translate(text, 'ru', 'en', function(result) {
        var translated = document.getElementById("translation");
        if (result.translation) {
          translated.innerHTML = result.translation;
        }
      });
    }
    google.setOnLoadCallback(initialize);

    </script>
  </head>
  <body style="font-family: Arial;border: 0 none;">
    <div id="content">Loading...</div>
  </body>
</html>
